package vn.gq.udv.utils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class GQUtils {
	
	public static String md5(String input) {
		try {
			StringBuilder sb = new StringBuilder();
			MessageDigest md = MessageDigest.getInstance("MD5");
			md.update(input.getBytes());
			byte[] hashByte = md.digest();
			for (int i=0;i<hashByte.length;i++) {
				sb.append(Integer.toHexString((hashByte[i] & 0xff) | 0x100).substring(1, 3));
			}
			return sb.toString();
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
		return null;
	}
	
}
